package com.redpack.redpost.util.Servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.ArrayList;


import java.util.List;

import com.redpack.redpost.util.dao.*;
import com.redpack.redpost.util.to.*;

/**
 * Servlet implementation class IsUsuarioExiste
 */
public class IsUsuarioExiste extends HttpServlet  implements javax.servlet.Servlet{
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public IsUsuarioExiste() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response); 
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		String respuesta = "false";
		String nip = "";
		boolean _res = false ;
		
		nip = request.getParameter("nip");
		
		try 
		{
	        if(nip != "")
	  	  	{
	        	_res = ArriboAdminDao.IsUsuarioExiste(nip);
			
	        	if(_res){
	        		respuesta = "true";
	        	}
	  	  }
	 } 
		catch (Exception ex) {
         ex.printStackTrace();
         response.getWriter().write(ex.toString());  
         respuesta = ex.toString();
         //System.out.println(ex);
     }
        response.getWriter().write(respuesta);  
	}


}